#!/usr/bin/evn python
# -*- coding: utf-8 -*-
from fastapi import FastAPI

from starlette.responses import FileResponse

app = FastAPI()


@app.get("/dwonfile1")
def sync_dwonfile():
    return FileResponse(path='./data.bat', filename='data.bat', media_type="application/octet-stream")


@app.get("/dwonfile2")
async def async_dwonfile():
    return FileResponse(path='./data.bat', filename='data.bat', media_type="application/octet-stream")


if __name__ == "__main__":
    import uvicorn
    import os

    app_model_name = os.path.basename(__file__).replace(".py", "")
    print(app_model_name)
    uvicorn.run(f"{app_model_name}:app", host='127.0.0.1')
